<?php
/**********************************************************************//**\file
	Armory Wowheroes XML Parser

	Description:  Provides specific functions for parsing WoWheroes guild data
		via http://xml.wow-heroes.com/xml-guild.php?z=REGION&r=REALM&g=GULIDNAME
*******************************************************************************/

	# http://xml.wow-heroes.com/xml-guild.php?z=us&r=Kirin+Tor&g=Faceroll+Syndicate

	class wowheroesxml extends armoryxml
	{
		protected $wowheroes;

		public function __construct()
		{
			$this->get_cache('guild', 'wowheroes');
			$this->wowheroes = new wowheroesdata();
		}

		public function parse()
		{
			$playerlist = $this->xmldata->getElementsByTagName('character');

			foreach ($playerlist as $player)
			{
				$name = utf8_decode($player->getAttribute('name'));
				$score = intval($player->getAttribute('score'));
				$date = $player->getAttribute('date');
				$suggest = $player->getAttribute('suggest');

				$this->wowheroes->add_player($name, $score, $date, $suggest);
			}
		}

		public function store()
		{
			$this->wowheroes->store();
		}

		public function debug()
		{
			$this->wowheroes->debug();
		}
	}
?>
